<template>
  <div>
    商品详情页面
    <el-form label-position="right" label-width="180px" :model="goods">
      <el-form-item label="商品名称">
        <el-input v-model="goods.gname" :disabled="flag"></el-input>
      </el-form-item>
      <el-form-item label="商品唯一标识">
        <el-input v-model="goods.goodsUniqueNo" :disabled="flag"></el-input>
      </el-form-item>
      <el-form-item label="商品分类">
        <el-input v-model="goods.goodsSorts.gsname" :disabled="flag"></el-input>
      </el-form-item>
      <el-button
        type="primary"
        size="mini"
        icon="el-icon-back"
        @click="returnOrder"
        >返回订单</el-button
      >
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      gid: "",
      goods: { goodsSorts: {} },
      flag: true,
    };
  },
  mounted() {
    this.gid = this.$route.params.gid;
    console.log(this.gid);
    this.getClient();
  },
  methods: {
    //返回订单
    returnOrder() {
      this.$router.push("/orderList");
    },

    //查询商品信息
    getClient() {
      this.$axios
        .get("/goods/getByGid", {
          params: {
            gid: this.gid,
          },
        })
        .then((resp) => {
          if (resp.data.code == 200) {
            this.goods = resp.data.data;
            console.log(this.goods);
          }
        });
    },
  },
};
</script>

<style>
</style>